/**
 * 
 */
package com.juliashine.common.mail;

import java.io.*;



import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import org.apache.commons.mail.SimpleEmail;


/**
 * @author Juliashine@gmail.com 2010-11-11
 *
 */
public class CommonsMail {

	
	void sendMail(Email email){
		HtmlEmail mailConfig = new HtmlEmail();
	}
	
	/**
	 * @param args
	 * @throws EmailException 
	 */
	public static void main(String[] args) throws EmailException {
		String filename="E:/light/requirement/17316/17316(2011-02-07_2011-02-13).html";
		StringBuilder sb = new StringBuilder();
		try {
			BufferedReader br = new BufferedReader(new FileReader(new File(filename)));
			String line = null;
			while((line = br.readLine())!= null){
				sb.append(line);
			}
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		HtmlEmail email = new HtmlEmail();
		email.setDebug(true);
//		email.setSSL(true);
//		email.setTLS(true);
		email.setHostName("smtp.163.com");
//		email.setSmtpPort(587);
//		DefaultAuthenticator auther = new DefaultAuthenticator("litb_bi@163.com", "8630440");
//		email.setAuthenticator(auther);

		email.setAuthentication("litb_bi@163.com","8630440");
		
//		email.addTo("zhouping@lightinthebox.com","");
//		email.addTo("chensuying@lightinthebox.com","");
//		email.addTo("zhangyuelun@lightinthebox.com","");
//		email.addTo("litb_product_frontend@lightinthebox.com","");
//		email.addTo("bi_backup@lightinthebox.com","");
//		email.addTo("zhangzhiyong@lightinthebox.com","");
		email.addTo("wanggenshen@lightinthebox.com","");
		email.setFrom("litb_bi@163.com", "chenshaobo@lightinthebox.com");
		
		email.setCharset("gb2312");
		email.setSubject("new_order&payment_confirm&order_shipped _report(2011-02-07_2011-02-13)");
		email.setHtmlMsg(sb.toString());
//		email.setMsg("test");
		email.send();
		
	}

	
}
